<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>点击</button>
    <script>
        //需求 点击了按钮，弹出一个对话框
        //1 事件源 按钮
        //2 事件类型 点击鼠标
        //3 事件处理程序 弹出对话框
        const btn = document.querySelector("button")
        btn.addEventListener("click", function () {
            alert('你好啊！')
        })
    </script>
</body>

</html>